<?php
// 本文档自动生成，仅供测试运行
class IndexAction extends BaseAction
{
    /**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
    public function index()
    {
        //$NbSite	= M("User");
		//$strJumpUrl = APP_NAME."://Mmp/";
		//var_dump(U($strJumpUrl));
		/*import("@.ORG.Page"); //导入分页类
                $count = $NbSite->count();    //计算总数
                $p = new Page ( $count, 5 );
		$list=$NbSite->limit($p->firstRow.','.$p->listRows)->order('site_id desc')->select();
		$p->setConfig('header','个网站');
		$p->setConfig('prev',"[上一页]");
		$p->setConfig('next','[下一页]');
		$p->setConfig('first','[第一页]');
		$p->setConfig('last','[末页]');
		$page = $p->show ();*/
		//$this->assign( "page", $page );
		//$this->assign ( "list", $list );
		$this->display();
        
    }
	
	//发送邮件测试
	public function smtp()
	{
		import("@.ORG.Smtp");
		$smtp = new Smtp();
		##########################################
		$smtpserver = "smtp.exmail.qq.com";//SMTP服务器
		$smtpserverport =25;//SMTP服务器端口
		$smtpusermail = "lqsun@gci-corp.com";//SMTP服务器的用户邮箱
		$smtpemailto = "wufujun2000@gmail.com,franken.sun@gmail.com,23143382@qq.com";//发送给谁
		$smtpuser = "lqsun@gci-corp.com";//SMTP服务器的用户帐号
		$smtppass = "lqsun123456";//SMTP服务器的用户密码
		$mailsubject = "The test mail";//邮件主题
		$mailbody = "<h1>This is a test mail by smtp class</h1><br/><a href='http://mmp.buypg.net'>访问</a>";//邮件内容
		$mailtype = "HTML";//邮件格式（HTML/TXT）,TXT为文本邮件
		##########################################
		$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.
		$smtp->debug = TRUE;//是否显示发送的调试信息
		$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
	}

    	// 处理表单数据
	public function reg() {
		$Form	=	D("User");
		if($Form->create()) {
			if(false !==$Form->add()) {
    			$this->success('注册成功');
            }else{
                $this->error('数据写入错误');
            }
		}else{
			$this->error($Form->getError());
		}
	}

    // 用户登录
    public function login()
    {
		$passport = getpassport($_POST['user_email'], $_POST['user_password']);
		//var_dump($passport);
		//exit();
		if(!is_array($passport))
		{
			if(-1==$passport)
            {
				$this->error('用户不存在');
            }
			if(-2==$passport)
            {
                $this->error('密码错误');
            }
        }
		else
		{
			checkauth();
			$strJumpUrl = APP_NAME."://Mmp/";
			$this->assign ( "jumpUrl", U($strJumpUrl) );
			$this->success('登陆成功');
		}
    }
	
	public function AddItem()
	{
		
	}
	
    /**
    +----------------------------------------------------------
    * 探针模式
    +----------------------------------------------------------
    */
    public function checkEnv()
    {
        load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
        $env_table = check_env();//根据当前函数获取当前环境
        echo $env_table;
    }

}
?>